﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DevExpress.UserSkins;
using TuongLaiDangCho.Enterface;
using System.Threading;
using System.Text;
using System.Diagnostics;

namespace TuongLaiDangCho
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        //public static Thread th0;
        //public static Thread th1;
        public static bool  b_flag=false;
        [STAThread]      
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DevExpress.Skins.SkinManager.EnableFormSkins();
            BonusSkins.Register();
            //if(Application.
            //Application.SetCompatibleTextRenderingDefault(WindowsFormsApplicationBase
            Process[] process;
            process = Process.GetProcesses();
            int dem = 0;
            for (int i = 0; i < process.Length; i++)
            {
                //MessageBox.Show(process[i].ProcessName);
                if (process[i].ProcessName == "Future")
                {
                    dem++;
                    //MessageBox.Show(process[i].ProcessName);
                    //return;                   
                }
                if (dem > 1)
                {
                    return;
                }                
                //if (dem == 1)
                //{
                //    Application.
                //}
            }
            Application.Run(new frmLogin());
            if (b_flag)
            {
                Application.Run(new frmHome());
            }
            //return -1;
        }

        //public static string ListAllProcesses()
        //{
        //    StringBuilder sb = new StringBuilder();
        //    // list out all processes and write them into a stringbuilder
        //    using (ManagementClass MgmtClass = new ManagementClass("Win32_Process"))
        //    {
        //        foreach (ManagementObject mo in MgmtClass.GetInstances())
        //        {
        //            sb.Append(string.Format("Name:{0}{1}{2}", Constants.vbTab, mo("Name"), Environment.NewLine));
        //            sb.Append(string.Format("ID:{0}{1}{2}", Constants.vbTab, mo("ProcessId"), Environment.NewLine));
        //            sb.Append(Environment.NewLine);
        //        }
        //    }
        //    return sb.ToString();
        //}
  
    }
}
